package com.ai.entity.made.page;

import com.ai.entity.BasePage;
import com.ai.entity.made.RegionBase;
import com.ai.model.vo.RegionBaseVo;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import org.apache.commons.lang3.StringUtils;
import org.springframework.util.CollectionUtils;

import java.util.List;

@Data
@Accessors(chain = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class RegionPage extends BasePage<RegionBase> {

    @ApiModelProperty(value = "id")
    private String id;

    @ApiModelProperty(value = "区域名称")
    private String regionName;

    @ApiModelProperty(value = "区域代号")
    private String regionCode;

    @ApiModelProperty(value = "责任人")
    private String responsibility;

    @ApiModelProperty(value = "联系方式")
    private String phone;

    @Override
    public QueryWrapper<RegionBase> getQuery(QueryWrapper<RegionBase> queryWrapper) {
        return queryWrapper
                .eq(StringUtils.isNotBlank(id),"id",id)
                .like(StringUtils.isNotBlank(regionName),"region_name",regionName)
                .like(StringUtils.isNotBlank(regionCode),"region_code",regionCode)
                .like(StringUtils.isNotBlank(responsibility),"responsibility",responsibility)
                .like(StringUtils.isNotBlank(phone),"phone",phone)
                .orderByDesc("update_time");
    }
}
